<template>
    <!--最大div-->
    <div style="margin-top: -10px">
        <!--新建栏-->
        <div style="border:1px solid #BFBFBF;padding: 10px;background-color: white;margin-top: 10px;height: 40px">
            <el-row :gutter="24">
                <el-col :span="2">
                    <span style="font-size: 18px;line-height:40px;margin-left: 5px">员工管理</span>
                </el-col>
                <el-col :span="7">
                    <el-select v-model="value7" @change="changebusni" style="width: 150px;margin-left: 20px" placeholder="全部商机">
                        <el-option-group
                                v-for="group in options3"
                                :key="group.label"
                                :label="group.label">
                            <el-option
                                    v-for="item in group.options"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-option-group>
                    </el-select>
                    <el-button style="background-color: #F05050;color: white;margin-left: 10px;" @click="cancelseek" icon="el-icon-back" v-show="seek" size="mini" round>解除搜索</el-button>
                </el-col>
                <el-col :span="9">
                    <el-input placeholder="请输入搜索的信息" v-model="input" style="width: 250px;">
                        <i slot="suffix" class="el-input__icon el-icon-search"></i>
                    </el-input>
                </el-col>
                <el-col :span="6">
                    <router-link style="line-height:40px;margin-left:80px;" :to="{path:'/zhuye/heton/xinzen'}">
                        <el-button size="small"  type="primary" @click="jilutankuan=true">新建合同</el-button>
                    </router-link>
                    <router-link style="margin-left:15px" :to="{path:'/zhuye/dindan/xinzen'}">
                        <el-button size="small"  type="primary">新建订单</el-button>
                    </router-link>
                </el-col>
            </el-row>
        </div>



        <!--表格数据框-->
        <div style="margin-top: 10px;border: 1px solid #BFBFBF;background-color: white">
            <div style="width: 100%;height: 40px;background-color: white;border-bottom: 1px solid #EBEEF5">
                <div class="operate" v-show="cjy">
                    <div class="selected—title" style="border-right: 0px ">
                        场景：<span>{{value7}}</span>
                    </div>
                </div>
                <div class="operate" v-show="cje">
                    <div class="selected—title" >
                        已选中<span class="selected—count">{{count}}</span>项
                    </div>
                    <div  class="selected—title2" v-show="isOne">
                        <span @click="isAddRecord=true"><i class="el-icon-circle-plus-outline"></i>添加跟进记录</span>
                    </div>
                    <div  class="selected—title1" v-show="isOne">
                        <span><i class="el-icon-edit"></i>修改</span>
                    </div>
                    <div  class="selected—title1">
                        <span><i class="el-icon-delete"></i>删除</span>
                    </div>
                </div>
            </div>
            <el-table
                    :data="empList"
                    style="width: 100%"
                    max-height="450"
                    :default-sort = "{prop: 'date', order: 'descending'}"
                    @selection-change="handleSelectionChange">
                <el-table-column
                        type="selection"
                        width="50"
                        align="center">
                </el-table-column>
                <el-table-column
                        fixed
                        prop="empId"
                        label="ID"
                        align="center"
                        width="80">
                </el-table-column>
                <el-table-column
                        label="员工姓名"
                        align="center"
                        width="130"
                        prop="empName">
                </el-table-column>
                <el-table-column
                        prop="empGender"
                        label="性别"
                        align="center"
                        width="100">
                </el-table-column>
                <el-table-column
                        prop="empPhone"
                        label="手机号码"
                        align="center"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="empAdd"
                        label="出生地址"
                        align="center"
                        width="150">
                </el-table-column>
                <el-table-column
                        prop="empSfz"
                        label="身份证号码"
                        align="center"
                        width="170">
                </el-table-column>
                <el-table-column
                        prop="empSalary"
                        label="薪资"
                        align="center"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="empService"
                        label="是否在职"
                        align="center"
                        width="120">
                </el-table-column>
                <el-table-column
                        prop="empMima"
                        label="员工密码"
                        align="center"
                        width="120">
                </el-table-column>
                <el-table-column
                        fixed="right"
                        label="操作"
                        align="center"
                        width="100">
                    <template>
                        <!--如果是三个标签，后两个标签padding-left: 10px;-->
                        <i style="font-size:18px;color: #409EFF" class="el-icon-edit"></i>
                        <i style="font-size:18px;padding-left: 20px;color: #409EFF" class="el-icon-delete"></i>
                    </template>
                </el-table-column>
            </el-table>
        </div>

        <!--分页框-->
        <div style="margin-top: 15px;border: 1px solid #BFBFBF;padding: 10px;background-color: white">
            <div style="text-align: center">
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="currentPage4"
                        :page-sizes="[100, 200, 300, 400]"
                        :page-size="100"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="400"
                >
                </el-pagination>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "Dbusiness",
        data() {
            return {
                multipleTable: [],//存放选中值的数组
                isOne:true,//选中项为1就出现添加跟进记录和修改
                //解除搜索是否显示
                seek:false,
                //下拉选择框
                options3: [{
                    label: '热门城市',
                    options: [{
                        value: '上海',
                        label: '上海'
                    }, {
                        value: '北京测试',
                        label: '北京'
                    }]
                }, {
                    label: '城市名',
                    options: [{
                        value: '成都成都',
                        label: '成都'
                    }, {
                        value: '深圳深圳',
                        label: '深圳'
                    }, {
                        value: '广州广州',
                        label: '广州'
                    }, {
                        value: '大连大连',
                        label: '大连'
                    }]
                }],
                value7: '',
                //场景一
                cjy:true,
                //场景二
                cje:false,
                //搜索框
                input23: '',
                //表格
                empList: [],
                //分页
                currentPage1: 5,
                currentPage2: 5,
                currentPage3: 5,
                currentPage4: 4
            }
        }, methods: {
            /*跳转详情方法*/
            todetails(rows){
                this.$router.push({
                    path:'/business/details',
                    query: {
                        row:rows
                    }

                })
            },
            initData(){
                window.console.log();
                this.$axios.post("http://localhost:8088/pur/emp-List")
                    .then(v=>{
                        this.empList = v.data;
                    })
                    .catch()
            },
            /*新建商机方法*/
            showmian(){

            },
            /*表格删除方法*/
            deleteRow(index, rows) {
                rows.splice(index, 1);
            },
            /*分页数方法*/
            handleSizeChange(val) {
                window.console.log(`每页 ${val} 条`);
            },
            /*当前页方法*/
            handleCurrentChange(val) {
                window.console.log(`当前页: ${val}`);
            },
            //复选框选中的
            handleSelectionChange(val) {
                this.multipleTable = val;//  this.multipleTable 选中的值
                if(this.multipleTable.length>0){
                    this.cjy=false;//第一行隐藏
                    this.cje=true;//批量操作栏出现
                }
                //选中项大于1不能执行添加跟进记录和修改按钮
                if(this.multipleTable.length>1){
                    this.isOne=false;
                }else if(this.multipleTable.length==0){//选中项为0时
                    this.cjy=true;//第一行出现
                    this.cje=false;//批量操作栏隐藏
                }else{
                    this.isOne=true;//添加跟进记录和修改出现
                }
                window.console.log(val);
            },
            /*选择类型商机方法*/
            changebusni(){
                if(this.value7!=''){
                    this.seek=true;
                }
            },
            /*解除选择类型商机方法*/
            cancelseek(){
                this.value7='';
                this.seek=false;
            }
        },
            computed:{
                count(){
                    return this.multipleTable.length
                }
            }, created: function () {
                this.initData();
            },

    }
</script>

<style scoped>

    .addview:hover{
        color: white;
    }
    a{
        text-decoration: none;
        color: #409EFF;
    }
    a:hover{
        color: white;
    }
    .busin:hover{
        color: #3E84E9;
        cursor:pointer;
    }
    .businame{
        color: #606266;
    }
    .businame:hover{
        color: #409EFF;
        cursor:pointer;
    }
    .operate{
        font-size: 12px;
        height: 40px;
        padding: 0 20px;
        color: #777;
        background: white;
    }
    .selected—title{
        margin-top: 15px;
        margin-left: -6px;
        border-right: 1px solid #e6e6e6;
        width: 86px;
        height:20px;
        float: left;
    }
    .selected—title1{
        margin-top: 15px;
        border-right: 1px solid #e6e6e6;
        width: 86px;
        height:20px;
        float: left;
        cursor: pointer;
    }

    .selected—title1 span{
        margin-left: 24px;
    }
    .selected—title1 span:hover{
        color:#409eff;
    }
    .selected—title2{
        margin-top: 15px;
        border-right: 1px solid #e6e6e6;
        width: 129px;
        height:20px;
        float: left;
        cursor: pointer;
    }

    .selected—title2 span{
        margin-left: 24px;
    }
    .selected—title2 span:hover{
        color:#409eff;
    }
</style>